The Choose Item scripting addition allows you to choose an AppleScript list item from a dialog box like the one illustrated below.
Figure 1. A Choose Item dialog box
A scripting addition is a command that is added to the AppleScript language as an extension. To install Choose Item, copy the "Choose Item" file into the Scripting Additions folder, which is located in the Extensions folder in your System folder. For more information about Scripting Additions, refer to the "AppleScript Language Guide" from Apple Computer, Inc.
SYNTAX
choose item choiceList [ with prompt promptString ] ¬
[ in order sortOrder ] [ default item defaultString ]
PARAMETERS
choiceList
The list of items to be proposed to the user.
Class: List of strings
promptString
The title that is displayed in the dialog box. If you omit the with prompt parameter, the string "Choose an item:" is displayed.
Class: String
Default Value: "Choose an item:"
sortOrder
The sorting order that is used to sort the items in the dialog box. If you omit the in order parameter, the items are not sorted.
Class: Enumerated. Possible values are Ascending and Descending.
Default Value: no sorting
defaultString
The item string that is first selected when the dialog box appears.
If defaultString is not in choiceList, it is appended to the list.
Class: String.
Default Value: no item selected
RESULT
The result is the text of the item selected by the user.
EXAMPLES
choose item {"Black","Yellow","Green","Blue","Red"} with prompt "Choose a color:" ¬
in order Ascending default item "Black"
set color of myObject to result
ERRORS
-1700 "Can't change <expression> into a <class>."
One of the choiceList items could not be displayed as a string.
-108 "Not enough memory to perform the operation."
Not enough memory to perform the operation.
- 128 "User cancelled the dialog box."
The Cancel button was pressed.
LEGAL NOTE
This external is copyright ACI, who shall not be responsible in any case of whatever may happen when this osax is used.